//package com.example.fresh_fruit.config;
//
//import com.example.fresh_fruit.interceptor.MyInterceptor;
//import com.example.fresh_fruit.service.BusinessPersionService;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
///**
// * @author :飞天の鱼
// * @date : 2022/8/21 22:53
// */
//
////拦截器配置
//@Configuration
////@Configuration  => 用于定义配置类，可替换xml配置文件，相当于<Beans></Beans>
//
//public class InterceptorConfig implements WebMvcConfigurer {
//    //传入员工的service，拦截员工
//
//    final BusinessPersionService businessPersionService;
//
//    public InterceptorConfig(BusinessPersionService businessPersionService) {
//        this.businessPersionService = businessPersionService;
//    }
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new MyInterceptor(businessPersionService))
//                // 拦截规则 ，拦截那些路径
//                .addPathPatterns("/**")
//                // 那些路径不拦截
//                .excludePathPatterns("/*login", "/");
//    }
////    @Bean
////    public MyInterceptor loginInterceptor(){
////        return new MyInterceptor();
////    }
//}
